package fhq.hcmute.edu.vn.message;

import java.io.Serializable;

public class MyMessage implements Serializable {

	private static final long serialVersionUID = 314133928306616317L;
	private Object[] datas;
	private int type;
	private int from;

	protected MyMessage() {

	}

	protected MyMessage(final int messageType, final Object... details) {
		this.datas = details;
		this.type = messageType;
	}

	protected MyMessage(final int messageType) {
		this.datas = null;
		this.type = messageType;
	}

	protected MyMessage(final MyMessage message) {
		this.datas = message.datas;
		this.type = message.type;
	}

	public final Object[] getData() {
		return datas;
	}

	public final Object getFirstData() {
		return datas[0];
	}

	public final int getType() {
		return type;
	}

	public final void setType(final int type) {
		this.type = type;
	}

	public int getFrom() {
		return from;
	}

	public void setFrom(int from) {
		this.from = from;
	}

	public Object get(int index) {
		return datas[index];
	}
}
